package com.atguigu.customerdemo.service.impl;

import com.atguigu.customerdemo.bean.Customer;
import com.atguigu.customerdemo.mapper.CustomerMapper;
import com.atguigu.customerdemo.service.CustomerService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@DS("mysql0718")
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public String getCustomerByName(String name) {
//        System.out.println("customerByName请求"+name);
        Customer customer = customerMapper.getCustomerByName(name);
        return "service处理成功:"+customer.toString();
    }

    @Override
    @DS("mysql0718")
    public void saveCustomer(Customer customer) {
        customerMapper.insert(customer);
    }
}
